package com.siqiaoren.dao;


import com.siqiaoren.domain.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserDao {
    @Insert("insert into ikun (username, password, phone) values(#{username}, #{password}, #{phone})")
    public int save(User user);

    @Delete("delete from ikun where id = #{id}")
    public int delete(Integer id);

    @Select("select * from ikun where username = #{username}")
    public User getByName(String username);

    @Select("select * from ikun where username = #{username} and password = #{password}")
    public int checkNamePassword(String username, String password);

    @Select("select * from ikun")
    public List<User> getAll();

}
